import React from "react";
import ReactDOM from "react-dom/client";
import { RouterProvider } from "react-router-dom";
import { ConfigProvider } from "antd";
import zhCN from "antd/locale/zh_CN";
import { router } from "./router";
import { UserProvider } from "./contexts/UserContext";
import { AuthProvider } from "./contexts/AuthContext";
import { WebSocketProvider } from "./contexts/WebSocketContext";
import { ExamProvider } from "./contexts/ExamContext";
import "normalize.css";
import "./styles/global.scss";

const root = ReactDOM.createRoot(
  document.getElementById("root") as HTMLElement
);

root.render(
  <ConfigProvider locale={zhCN}>
    <AuthProvider>
      <UserProvider>
        <WebSocketProvider>
          <ExamProvider>
            <RouterProvider router={router} />
          </ExamProvider>
        </WebSocketProvider>
      </UserProvider>
    </AuthProvider>
  </ConfigProvider>
);
